package practice;

import java.util.Scanner;


public class practice03 {

	public static void main(String[] args) {
		 System.out.println("Please input your nums:");
	        Scanner scanner=new Scanner(System.in);
	        double num1=scanner.nextDouble();
	        double num2=scanner.nextDouble();
	        if (num1==num2)
	        {
	            System.out.println("最大公约数为"+num1);
	            return;
	        }
	        else
	        {
	            while(true)
	            {
	                if (num1 > num2)
	                {
	                    num1 =num1- num2;
	                }
	                else if(num1 < num2)
	                {
	                    num2 =num2-num1;
	                }
	                else
	                {
	                   System.out.println(num1+"是最大公约数");
	                   break;
	                }
	            }
	        }

	}

}
